//
//  TTMainTabBarController.m
//  TTWeibo
//
//  Created by 陶宏路 on 16/7/19.
//  Copyright © 2016年 陶路路. All rights reserved.
//

#import "TTMainTabBarController.h"
#import "TTHomeViewController.h"
#import "TTDiscoverViewController.h"
#import "TTMassageViewController.h"
#import "TTProfileViewController.h"
#import "TTTabBar.h"
@interface TTMainTabBarController ()



@end

@implementation TTMainTabBarController

-(void)viewDidLoad{
    
    [super viewDidLoad];
    
    TTTabBar * tab = [[TTTabBar alloc]init];
    
    [self setValue:tab forKey:@"tabBar"];
    
    [self setUpUI];
    
}

-(void)setUpUI{
    
    [self setUpController:[[TTHomeViewController alloc]init] With:@"首页" and:@"tabbar_home"];
    [self setUpController:[[TTMassageViewController alloc]init] With:@"消息" and:@"tabbar_message_center"];
    [self setUpController:[[TTDiscoverViewController alloc]init] With:@"发现" and:@"tabbar_discover"];
    [self setUpController:[[TTProfileViewController alloc]init] With:@"我" and:@"tabbar_profile"];
    
}

-(void)setUpController:(UIViewController*)vc With:(NSString*)title and:(NSString*)img{
    
    vc.title = title;
    [self addChildViewController:[[UINavigationController alloc]initWithRootViewController:vc]];
    vc.tabBarItem.image = [[UIImage imageNamed:img] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    vc.tabBarItem.selectedImage = [[UIImage imageNamed:[NSString stringWithFormat:@"%@_selected",img]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    vc.tabBarItem.title = title;
    vc.tabBarController.tabBar.tintColor = [UIColor orangeColor];

    
}
@end
